package com.zhongge.controller;


import com.zhongge.entity.Clazz;
import com.zhongge.service.impl.TeacherClassServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Objects;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author zhongge
 * @since 2025-11-09
 */
@Controller
@RequestMapping("/teacher-class")
public class TeacherClassController {
    @Autowired
    private TeacherClassServiceImpl teacherClassService;

    //根据辅导员ID查询所有班级信息==》用于初始化
    @ResponseBody
    @GetMapping("/showAllClassInfo")
    public Map<String, Object> showAllClassInfo(Integer id){
        Map<String, Object> map = new HashMap<>();
        List<Clazz> clazzes = teacherClassService.showAllClassInfo(id);
        if (clazzes.size() != 0){
            map.put("success",true);
            map.put("msg",clazzes);
        }else {
            map.put("success",false);
            map.put("msg","你没有所要关联的班级！请创建");
        }
        return map;
    }
}
